﻿<%@ Control Language="C#" Inherits="System.Web.Mvc.ViewUserControl<dynamic>" %>

<table>
<tr>
<td>
<%
    var ValidationSettings = new DevExpress.Web.ASPxUploadControl.ValidationSettings{
        AllowedFileExtensions = new string[] { ".pdf" },
        MaxFileSize = 20971520
    };
    
    using (Html.BeginForm("Callbacks", "Contracts", FormMethod.Post, new { @class = "imagePreview" }))
    {
        Html.DevExpress().UploadControl(
            settings =>
                {
                    settings.Name = "ucCallbacks";
                    settings.CallbackRouteValues = new { Controller = "Contracts", Action = "CallbacksImageUpload", idContract = ViewData["contractId"] };
                    settings.ControlStyle.CssClass = "editorArea";

                    settings.ShowProgressPanel = true;
                    
                     
                    
                    settings.ValidationSettings.Assign(ValidationSettings);

                    settings.ClientSideEvents.FileUploadComplete =
                        "function(s,e){ if(e.callbackData != '') $('#previewImage').attr('src', e.callbackData); }";
                }).GetHtml();


  

%>
</td>
<td>
              <div class="editorArea">
            <input type="button" value="<%: CRM.Resourses.Resourses.Upload %>"  onclick="ucCallbacks.Upload()" />
        </div>
        </td>
</tr>
</table>
 
        <% } %>
